import 'package:flutter/material.dart';
import 'package:nyh_motorcade_app/styles/colors.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'multi_state_widget.dart';

class DefaultFailWidget extends StatefulWidget {
  final Color backGroundColor;
  final MultiModel? model;
  final String failIcon;
  final String failText;

  DefaultFailWidget({
    Key? key,
    this.backGroundColor = Colours.color_background,
    this.model = MultiModel.normal,
    this.failIcon = "images/ic_fail.png",
    this.failText = "服务器繁忙 请稍后再试",
  }) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return _DefaultFailWidgetState();
  }
}

class _DefaultFailWidgetState extends State<DefaultFailWidget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: widget.backGroundColor,
      child: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Image.asset(widget.model != null ? (widget.model == MultiModel.normal ? "images/ic_fail.png" : "images/ic_fail_tint.png") : widget.failIcon),
            SizedBox(
              height: 5.w,
            ),
            Text(
              widget.failText,
              style: TextStyle(
                color: Colours.color_333333_50,
                fontSize: 14.sp,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
